//
// Created by win10 on 24-12-18.
//
#include<stdio.h>
int Bsearch(int *a, int n, int k,int *p);
int main(){
    int n,cmp,*p=&cmp;
    int pos,num=0;
    int low=0,high,mid,k;
    while(~scanf("%d",&n))
    {
        int a[n];
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        scanf("%d",&k);
        int pos=Bsearch(a,n,k,p);
        printf("%d\n%d\n",pos,cmp);
    }
    return 0;
}
/* 请在这里填写答案 */
int Bsearch(int *a, int n, int k,int *p) {
    int low=0,high=n-1,mid;
    *p=0;
    while(low<=high) {
        mid=(low+high)/2;
        (*p)++;
        if(a[mid]==k) {
            return mid;
        }
        else if(a[mid]>k) {
            high=mid-1;
        }else {
            low=mid+1;
        }
    }
    return -1;
}